// 充电桩智能终端时间同步
exports.send = (socket, data, core) => {
  const userIdBuf = core.createIntBuffer(2, 2);
  const cmdIndexBuf = core.createIntBuffer(1, 2);
  const date = core.date.date2Buffer(new Date(parseInt(data.millisecond)));
  let publisher = core.getService('redis').getClient();
  // 监听 0x52 的回复
  socket.once(`0x52-${userIdBuf.toString('hex')}-${cmdIndexBuf.toString('hex')}`, (date) => {
    publisher.publish('commandback', JSON.stringify({
      result: { date: date },
      callback: data.callback,
    }));
  })
  socket.sendCommands(0x42, core.concat([userIdBuf, cmdIndexBuf, date]));
}

